Ext.define("wmf.view.billing.add", {
    extend: "wmf.lib.FormPanel",
    alias: "widget.billingAdd",
	anchor: '100% 100%',
    border: false,
    autoScroll: true,
    fieldDefaults: {
        labelWidth: 90
    },
    items: [{
    	xtype: 'combo',
		emptyText:  '请选择...',
		hiddenName: 'productNameOrId',
		autoSelect: true,
		displayField: 'name',
		queryMode: 'remote',
		valueField: 'productNameOrId',
		triggerAction: 'all',
		store: 'billing.productNameOrId',
        name: "productId",
        minChars: 1,
		forceSelection : true,
		selectOnFocus : true,
        listeners : {
			'beforequery': function(e){
				wmf.data.filterQuery(e);
			},
			'select': function(combo, records, eOpts ){
				combo.up('panel').loadRecord(records[0]);
			}
		},
        fieldLabel: "产品名称"
    },{
        xtype: "textfield",
        name: "id", 
        readOnly: true,
        editable: false,
        fieldLabel: "产品ID"
    },{
        xtype: "textfield",
        name: "ecName", 
        editable: false,
        readOnly: true,
        fieldLabel: "企业名称"
    },{
        xtype: "textfield",
        name: "ecId", 
        editable: false,
        readOnly: true,
        fieldLabel: "企业ID"
    },{
    	xtype: 'combo',
 		emptyText:  '请选择...',
 		hiddenName: 'channelType',
 		autoSelect: true,
 		displayField: 'name',
 		queryMode: 'local',
 		valueField: 'channelType',
 		allowBlank: false,
 		triggerAction: 'all',
 		editable: false,
 		readOnly: true,
 		store: 'channel.channelType',
        name: "businessType", 
        fieldLabel: "业务类型"
    },{
    	xtype: 'combo',
 		emptyText:  '请选择...',
 		hiddenName: 'serviceType',
 		autoSelect: true,
 		displayField: 'name',
 		allowBlank: false,
 		queryMode: 'local',
 		valueField: 'serviceType',
 		triggerAction: 'all',
 		editable: false,
 		readOnly: true,
 		store: 'product.serviceType',
        name: "serviceType", 
        fieldLabel: "服务种类"
    },{
    	xtype: 'combo',
		emptyText:  '请选择...',
		hiddenName: 'billingType',
		autoSelect: true,
		displayField: 'name',
		queryMode: 'remote',
		valueField: 'billingType',
		triggerAction: 'all',
		editable: false,
		allowBlank: false,
		store: 'channel.billingType',
        name: "billingType", 
        fieldLabel: "计费方式"
    },{
        fieldLabel: "产品价格（元）",
        xtype: 'fieldcontainer',
        combineErrors: true,
        msgTarget : 'side',
        layout: 'hbox',
        items: [{
        	xtype: "textfield",
            name: "cmccPrice", 
            labelWidth: 30,
            flex: 3,
            vtype: 'productPrice',
            fieldLabel: "移动"
        },{
        	xtype: "textfield",
            name: "unicomPrice", 
            labelWidth: 30,
            flex: 3,
            vtype: 'productPrice',
            fieldLabel: "联通"
        },{
        	xtype: "textfield",
            name: "telcomPrice", 
            labelWidth: 30,
            flex: 3,
            vtype: 'productPrice',
            fieldLabel: "电信"
        }]
    },{
        xtype: "checkbox",
        name: "billingOnSuccess", 
        inputValue: '1',
        boxLabel: "按成功计费"
    }],
    
	dockedItems: [{
		xtype: 'toolbar',
		dock: 'bottom',
		layout: {
				type: 'hbox',
				alian: 'center',
				flex: 1
		},
		
		defaults: {
				xtype: 'button'
		},
		items: [{
			xtype : 'tbfill'
		},{
			itemId: 'save',
			icon: 'resources/icons/add.png',
			formBind: true,
			text: translations.global.operation.add
		},{
			itemId: 'reset',
			icon: 'resources/icons/icon_recover.png',
			text: translations.global.operation.reset
		},{
			itemId: 'cancel',
			icon : 'resources/icons/icon_revoke.png',
			text: translations.global.operation.cancel
		}]
	}]
});